import {createApp} from "vue";
// 引入主组件
import App from "@/App.vue";
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import router from "@/router";
// 引入element-plus样式
import "element-plus/dist/index.css";
// 引入nprogress样式
import "nprogress/nprogress.css";
// 引入自已定义的公共样式
import "@/assets/less/common.less";
import "@/assets/less/reset.less";
import store from "@/store";
import {GET_TOKEN} from "@/utils";
import useAdmin from "@/store/modules/admin.ts";
const app = createApp(App)

const adminStore = useAdmin(store);
// 将图标库组件设置为全局组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

// 将路由信息配置完毕之后再去挂载内容
if(GET_TOKEN()){
    await adminStore.getAdminInfoAsync();// -2--->清除localStorage->token------>跳转至登陆界面
}


app.use(store).use(router).mount("#app");

// console.log(import.meta.env.VITE_APP_TITLE)





